package com.zx.mobile;

import com.zx.map.utils.MyBeanUtils;
import com.zx.platform.utils.HttpClientCommon;
import java.io.IOException;
import java.util.Map;

public class MobileCommonHelper {
    /**
     * 任务类型  1、	商户新增
     * 2、	终端绑定
     * 3、	终端解绑
     */
    public static final String TASKTYPE_MERCHANTADD = "1";
    public static final String TASKTYPE_TEMINALBIND = "2";
    public static final String TASKTYPE_TEMINALUNBAND = "3";


    /**
     * 代办任务操作类别   1、	新增		2、	修改
     */
    public static final String TASKOPERATORTYPE_ADD = "1";
    public static final String TASKOPERATORTYPE_UPDATE = "2";
    /**
     * 产品类型app  pos终端 超级收银台
     */
    public static final String PRODUCTTYPE_APP = "1";
    public static final String PRODUCTTYPE_POS = "2";
    public static final String PRODUCTTYPE_SUPERR = "3";

    /**
     * 商户类型 个人 个体户 商户
     */
    public static final String MERCHANTTYPE_PERSON = "1";//个人
    public static final String MERCHANTTYPE_INDIVIDE = "2";//个体户
    public static final String MERCHANTTYPE_BUSSINESS = "3";// 商户

    /**
     * 审核类型 待审核 审核通过 审核拒绝
     */
    public static final String APPROVESTATUS_WAIT = "0";
    public static final String APPROVESTATUS_SUCCESS = "1";
    public static final String APPROVESTATUS_REFUSE = "2";
    public static final String APPROVESTATUS_MIDDLE = "3";//中间状态


    /**
     * app用户状态 检查用户状态  0--表示绑卡正常  1--正在绑卡未审核通过  2--未提交绑卡申请  3--审核拒绝  4--锁定
     */
    public static final String APPUSERSTATUS_NORMARL = "0";
    public static final String APPUSERSTATUS_WAIT = "1";
    public static final String APPUSERSTATUS_NOTREQUEST = "2";
    public static final String APPUSERSTATUS_REFUSE = "3";
    public static final String APPUSERSTATUS_LOCK = "4";
    

    /**
     * 密码类型 0=登陆密码  1=交易密码
     */
    public static final String PWDTYPE_LOGIN = "0";
    public static final String PWDTYPE_TRADE = "1";

    /**
     * 取现类型 1=T+1  0=T+0
     */
    public static final String ENCASHTYPE_T0 = "0";
    public static final String ENCASHTYPE_T1 = "1";
    public static final String ENCASHTYPE_T3 = "3";
    /**
     * 对公对私标志 0私人，1公司。不填时，默认为私人0
     */
    public static final String ACCOUNTPROP_PRIVATE = "0";
    public static final String ACCOUNTPROP_PUBLIC = "1";

    /**
     * 入款状态 N-初始  S-成功 F--失败
     */
    public static final String INCOMESTATUS_NORMAL = "N";
    public static final String INCOMESTATUS_SUCCESS = "S";
    public static final String INCOMESTATUS_FAIL = "F";

    /**
     * 出款状态 N-初始  S-成功 F--失败
     */
    public static final String OUTCOMESTATUS_NORMAL = "N";
    public static final String OUTCOMESTATUS_SUCCESS = "S";
    public static final String OUTCOMESTATUS_FAIL = "F";
    public static final String OUTCOMESTATUS_PROCESS = "P";

    /**
     * 卡类型 D-储蓄卡 C-信用卡
     */
    public static final String CARDTYPE_DEBIT = "D";
    public static final String CARDTYPE_CREDIT = "C";

    /**
     * 发送短信类型 注册 忘记密码  审核通过
     */
    public static final String MESSAGETYPE_SETTLE_TYPE = "S";
    public static final String MESSAGETYPE_REGISTER = "R";
    public static final String MESSAGETYPE_FORGETPWD = "F";
    public static final String MESSAGETYPE_USERREVIEW = "U";
    public static final String MESSAGETYPE_CREDITNOTIFY = "C";
    public static final String MESSAGETYPE_GAME = "GC";//游戏充值

    public static final String MESSAGETYPE_SETTLE_TYPE_T= "SMS_105965056";
    public static final String MESSAGETYPE_REGISTER_T = "SMS_105860047";
    public static final String MESSAGETYPE_FORGETPWD_T = "SMS_105870051";
    public static final String MESSAGETYPE_USERREVIEW_T = "SMS_105925071";
    
    /**
     * 1、回退修改密码  2、回退取现   3、回退信用卡还款  4、回退分享收益
     */
    public static final String URLRETURN_MODIFYPWD = "1";
    public static final String URLRETURN_ENCHASH = "2";
    public static final String URLRETURN_CREDIT = "3";
    public static final String URLRETURN_SHAREPROFIT = "4";

    /**
     * 代言人类型 1=普通合伙人  2=高级合伙人
     */
    public static final String NORMAL_AGENT = "1";
    public static final String SUPER_AGENT = "2";

    /**
     * 系统登录时时间 单位小时
     */
    public static final int SYSLOGINTIMEOUT = 1;
    /**
     * 系统短信超时时间 单位分钟
     */
    public static final int SYSMESSAGETIMEOUT = 1;  //短信超时时间设定   5分钟超时
    /**
     * 系统app图片上传格式
     */
    public static final String SYSUPLOADIMGTYPE = ".JPG";
    /**
     * 系统图片上传地址
     */
    public static final String SYSTIMESAVEPATH = "/uploadFile";

    /**
     * 风控通过代表代码
     */
    public static final String RISKPASSCODE = "0000";

    /**
     * json转对象
     *
     * @param <T>
     * @param jsonStr
     * @param clazz
     * @return
     */
    public static <T> T transFormJson(String jsonStr, Class<T> clazz) {
        return MyBeanUtils.jsonToBean(jsonStr,clazz);
    }

    /**
     * 请求转对象 gett
     *
     * @param <T>
     * @param requestUrl
     * @param clazz
     * @return
     */
    public static <T> T httpRequest(Class<T> clazz, String requestUrl) {
        HttpClientCommon httpClientCommon = new HttpClientCommon();
        return httpClientCommon.getResult(clazz, requestUrl);
    }

    /**
     * 请求转对象 post
     *
     * @param <T>
     * @param requestUrl
     * @param clazz
     * @return
     */
    public static <T> T httpRequest(Class<T> clazz, String requestUrl, Map<String, String> params) {
        HttpClientCommon httpClientCommon = new HttpClientCommon();
        return httpClientCommon.getResult(clazz, requestUrl, params);
    }


}
